import React from 'react';
import "./GoPop.less"
import {
    SearchBar,
    InputItem,
    List,
    WingBlank,
    Carousel,
    Stepper,
    Button,
    Modal
} from 'antd-mobile';
import { getGoods} from '@/api/classify';
import TabBarExample from 'components/tabBar'
import TopBarExample from 'components/topBar'
import qs from 'qs'


export default class ClassifyGoodDetail extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            goodData: props.goodData,
            buyPop: true,
            goNum:1,
        };
    }

    componentDidMount() {

    }

    // 立即购买
    nowPay = () => {
        this.props.history.push({pathname:'/classify/good/payOrder/', state:{id:123}})
    };


    changeNum = (val) => {
        this.setState({
            goNum: val
        });
    };

    render() {
        return (
            <Modal
                popup
                visible={true}
                onClose={() => {this.props.cancel()}}
                animationType="slide-up"
            >
                <div className="goPop">
                    <div className="goPop-top">
                        <div className="goPop-top-img" onClick={this.goShopCar}>
                            <img
                                src={this.state.goodData.cover}
                                alt=""
                                style={{ width: '50px', height: '50px'}}
                                onLoad={() => {
                                    // fire window resize event to change height
                                }}
                            />
                        </div>
                        <div className="goPop-top-r">
                            <div className="goPop-top-r-title">
                                {this.state.goodData.name}
                            </div>
                            <div className="goPop-top-r-price">
                                {this.state.goodData.price_selling}
                            </div>
                        </div>
                    </div>
                    <div className="goPop-content">
                        <span>数量：</span>
                        <Stepper
                            showNumber
                            min={1}
                            value={this.state.goNum}
                            onChange={this.changeNum}
                        />
                    </div>
                    <div className="goPop-foot" onClick={() => {this.nowPay}}>立即购买</div>
                </div>
            </Modal>
        );
    }
}

